<%@page import="Tools.ConvertUnixTime"%>
<%@page import="Entity.News"%>
<%@page import="java.util.List"%>
<%@page import="DAO.DAO_News"%>
<h1 class="page-header">List all contents</h1>
<div class="table-responsive">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>Title</th>
                <th>Category</th>
                <th>Author</th>
                <th>Time</th>
            </tr>
        </thead>
        <tbody>
<%
    DAO_News daonews = new DAO_News();
    List<News> newsList = daonews.newsList();
    for(News news : newsList) {
        
    
%>
            <tr data-url="<%=news.getId()%>" class="content-context-menu">
                <td><%=news.getTitle()%></td>
                <td><%=news.getCatname()%></td>
                <td><%=news.getAuthor()%></td>
                <td><%=ConvertUnixTime.normalTime(news.getDateline())%></td>
            </tr>
<%
    }
%>
        </tbody>
    </table>
</div>
<a class="btn btn-primary btn-lg " style="border-radius: 0" href="Dashboard.jsp?view=add-content"><i class="fa fa-plus-square"></i> Add New Content</a>